package com.keray.web.push.store.impl;

import com.keray.web.push.MessageType;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author by keray
 * date:2019/12/4 3:19 PM
 */
@Document(collection = "web_push_message_data")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Getter
@Setter
public class MongoMessageModel implements Serializable {

    @Id
    private String id;

    @Indexed
    private String service;

    @Indexed
    private String targetId;

    // 0 uid | 1 group | 2 service
    @Indexed
    private int channel;

    private Object message;
    // 消息类型| push 推送消息
    private MessageType type;

    private Integer retry = 1;

    private Boolean flag;

    private LocalDateTime createdTime;

    private LocalDateTime sendTime;

    private Integer version = 0;
}
